#include<stdio.h>
int main()
{
    //freopen("in.txt","r",stdin);
    int N;
    int x[105][105] = {0};
    scanf("%d",&N);
    int m = N*N;
    if(N%2 == 1)
    {
        x[0][N/2] = 1;
        int h,l;
        for(int i = 2; i <= m ; i++)
        {
            int k = 0;
            if(k == 0)
            {
                for(int a = 0; a < N - 1; a++)
               {
                   if(x[0][a] == i-1)
                   {
                       k = 1;
                       h = 0;
                       l = a;
                   }
               }
            }
            if(k == 0)
            {
                for(int a = 1; a < N; a++)
                {
                    if(x[a][N-1] == i-1)
                    {
                        k = 2;
                        h = a;
                        l = N-1;
                    }
                }
            }
            if(k==0)
            {
                if(x[0][N-1] == i-1)
                {
                    k = 3;
                    h = 0;
                    l = N-1;
                }
            }
            if(k==0)
            {
                for(int a = 1;a < N;a++)
                {
                    for(int b = 0; b <N-1; b++)
                    {
                        if(x[a][b] == i-1)
                        {
                            if(x[a-1][b+1] == 0)
                            {
                                k = 4;
                                h = a - 1;
                                l = b + 1;
                            }
                            else
                            {
                                k = 4;
                                h = a + 1;
                                l = b;
                            }
                        }
                    }
                }
            }
            if(k == 1)
                x[N-1][l+1] = i;
            else
            if(k == 2)
                x[h-1][0] = i;
            else
            if(k == 3)
                x[h+1][l] = i;
            else
            if(k==4)
                x[h][l] = i;
        }
    }
    for(int i = 0; i < N; i++)
    {
        for(int j = 0; j < N; j++)
        {
            printf("%d ",x[i][j]);
        }
        printf("\n");
    }
}